<!DOCTYPE html>
{% load staticfiles %}
<html>

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    {% block title %}
    <title></title>
    {% endblock %}
    <link rel="stylesheet" type="text/css" href="{% static 'css/reset.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'css/animate.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'js/plugins/queryCity/css/cityLayout.css' %}">
    {% block custom_css%} {% endblock %}
    <script src="{% static 'js/jquery.min.js' %}" type="text/javascript"></script>
    <script src="{% static 'js/jquery-migrate-1.2.1.min.js' %}" type="text/javascript"></script>
    {% block custom_js%} {% endblock %}
</head>
<body>
<section class="headerwrap headerwrap2">
    <header>
        <div class="header2 header">
            <div class="top">
                <div class="wp">
                    <div class="fl"><p>服务电话：<b>13720737094</b></p></div>
                    <!--登录后跳转-->
                    {% if request.user.is_authenticated %}
                    <div class="personal">
                        <dl class="user fr">
                            <dd>{{ user.username }}<img class="down fr" src="{% static 'images/top_down.png' %}"/></dd>
                            <dt><img width="20" height="20" src="{{ MEDIA_URL }}{{ user.image }}"/></dt>
                        </dl>
                        <div class="userdetail">
                            <dl>
                                <dt><img width="80" height="80" src="{{ MEDIA_URL }}{{ user.image }}"/>
                                </dt>
                                <dd>
                                    <h2>{{ user.nickname }}</h2>
                                    <p>{{ user.username }}</p>
                                </dd>
                            </dl>
                            <div class="btn">
                                <a class="personcenter fl" href="{% url 'users:user_info' %}">进入个人中心</a>
                                <a class="fr" href="{% url 'logout' %}">退出</a>
                            </div>
                        </div>
                    </div>
                    {% else %}
                    <a style="color:white" class="fr registerbtn" href="{% url 'register' %}">注册</a>
                    <a style="color:white" class="fr loginbtn" href="{% url 'login' %}?next={{ request.path }}">登录</a>
                    {% endif %}

                </div>
            </div>
            <div class="middle companyheader">
                <div class="wp">
                    <img class="fl" style="width: 112px;height: 103px; margin-top: 6px" src="{{ MEDIA_URL }}{{ course_org.image }}"/>
                    <div class="head fl">
                        <h1>
                            {{ course_org.name }}
                        </h1>
                    </div>
                    <div class="btn fr collectionbtn  notlogin" data-favid="22" data-fav-type="1">
                        {% if has_fav %}
                            已收藏
                        {% else %}
                            收藏
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    </header>
</section>
<section>
    <div class="wp">
        <ul class="crumbs">
            <li><a href="{% url 'index' %}">首页</a>></li>
            <li><a href="{% url 'organization:org_list'%}">课程机构</a>></li>
            <li>{% block page_path %}{% endblock %}</li>
        </ul>
    </div>
</section>

<section>
    <div class="wp list personal_list comp">
        <div class="left">
            <ul>
                <li class="{% ifequal current_page 'home' %}active2{% endifequal %}"><a href="{% url 'organization:org_home' course_org.id %}">机构首页</a></li>
                <li class="{% ifequal current_page 'course' %}active2{% endifequal %}"><a href="{% url 'organization:course_list' course_org.id %}">机构课程</a></li>
                <li class="{% ifequal current_page 'describe' %}active2{% endifequal %}"><a href="{% url 'organization:describe' course_org.id %}">机构介绍</a></li>
                <li class="{% ifequal current_page 'teacher' %}active2{% endifequal %}"><a href="{% url 'organization:org_teacher' course_org.id %}">机构讲师</a></li>
            </ul>
        </div>
        {% block right_form %}{% endblock %}
    </div>
</section>
<!--sidebar start-->
<section>
    <ul class="sidebar">
        <li class="qq">
            <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=2023525077&site=qq&menu=yes"></a>
        </li>
        <li class="totop"></li>
    </ul>
</section>
<!--sidebar end-->
<script src="/static/js/plugins/jquery.scrollLoading.js"  type="text/javascript"></script>

<script src="/static/js/deco-common.js" type='text/javascript'></script>
<script src="{% static 'js/selectUi.js' %}" type='text/javascript'></script>
<script type="text/javascript" src="{% static '' %}js/plugins/laydate/laydate.js"></script>
<script src="{% static 'js/plugins/layer/layer.js' %}"></script>
<script src="{% static 'js/plugins/queryCity/js/public.js' %}" type="text/javascript"></script>

<script type="text/javascript" src="{% static 'js/plugins/jquery.raty.js' %}"></script>
<script type="text/javascript">
// 收藏分享
function add_fav(current_elem, fav_id, fav_type){
    $.ajax({
        cache: false,
        type: "POST",
        url:"{% url 'organization:add_fav' %}",
        data:{'fav_id':fav_id, 'fav_type':fav_type},
        async: true,
        beforeSend:function(xhr, settings){
            xhr.setRequestHeader("X-CSRFToken", "{{ csrf_token }}");
        },
        success: function(data) {
            if(data.status == 'fail'){
                if(data.msg == '用户未登录'){
                    window.location.href="{% url 'login' %}?next={{ request.path }}";
                }else{
                    alert(data.msg)
                }

            }else if(data.status == 'success'){
                current_elem.text(data.msg)
            }
        },
    });
}

$('.collectionbtn').on('click', function(){
    add_fav($(this), {{ course_org.id }}, 2);
});
</script>
</body>
</html>
